<template>
	<u-popup :show="popup_show" mode="bottom" :safeAreaInsetBottom="false" bgColor="#040201" @close="hide()" round="15">
		<view class="popup">
			<view class="popup-wrap">
				<view class="title-line">
					<text class="title">切换语言</text>
					<view class="close-ioc">
						<i-icon name="iconfont-icon-guanbi1" color="#FFFFFF" size="40rpx" @click="hide()"></i-icon>
					</view>
				</view>
				<view class="content">
					<view class="list">
						<view class="item" v-for="(item,index) in list" :key="index" @click="onSelectLang(item)">
							<span>{{item.label}}</span>
							<i-icon name="iconfont-icon-xiangyou" color="#ffffff" size="28rpx" @click="onSelectLang(item)"></i-icon>
						</view>

					</view>

				</view>
			</view>
		</view>
		<u-toast ref="uToast" />
	</u-popup>
</template>

<script>
	export default {
		data() {
			return {
				popup_show: false,
				list: [
					{ label: "繁体中文", value: "zh" },
					{ label: "English", value: "en" },
				]
			};
		},

		methods: {
			show() {
				this.popup_show = true
			},
			onSelectLang(e) {
				this.$store.commit('setLang', e.value)
				this._i18n.locale = e.value
				this.hide()
			},
			hide() {
				this.popup_show = false
				this.$emit('cancel')
			}
		}
	}
</script>


<style lang="scss" scoped>
	.popup {
		width: 750rpx;
		background-color: #1f0e02;
		border-radius: 24rpx 24rpx 0 0;
	}

	.popup-wrap {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		border-radius: 20rpx;

		.title-line {
			position: relative;
			display: flex;
			align-items: center;
			padding: 0 30rpx;
			height: 150rpx;

			.title {
				line-height: 120rpx;
				font-size: 24rpx;
				color: #A5D3FF;
				margin-left: 10rpx;
			}

			.close-ioc {
				position: absolute;
				right: 40rpx;
			}
		}

		.content {
			padding: 0rpx 30rpx;
			color: #FFFFFF;
			font-size: 30rpx;


			.list {
				display: flex;
				flex-direction: column;
				padding-bottom: 50rpx;

				.item {
					display: flex;
					align-items: center;
					padding: 30rpx 0;

					span {
						font-weight: normal;
						color: #ffffff;
						font-size: 24rpx;
						flex: 1;
					}

					span:nth-child(3) {
						text-align: right;
					}

					.status {
						display: flex;
						align-items: center;
					}

					.status-01::before {
						content: "";
						display: block;
						width: 14rpx;
						height: 14rpx;
						border-radius: 10px;
						background-color: #00FF6F;
						margin-right: 10rpx;
					}

					.status-02::before {
						content: "";
						display: block;
						width: 14rpx;
						height: 14rpx;
						border-radius: 10px;
						background-color: #FF0000;
						margin-right: 10rpx;
					}
				}
			}

		}

	}
</style>